<template>
    <div ref="player"></div>
</template>

<script>
import Player from 'xgplayer';

export default {
    name: 'VoVideoPlayer',
    props: {
        url: String,
        options: Object,
    },
    mounted() {
        this.create()
    },
    beforeDestroy() {
        //卸载
        if(this.instance) {
            this.instance.destroy()
            this.instance = null;
        }
    },
    methods: {
        create() {
            const _this = this;

            this.instance = new Player({
                el: _this.$refs.player,
                url: _this.url,
                ..._this.options
            })
        }
    }
}
</script>

<style>

</style>